home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / GRAPHICS / UVE138.ZIP / EXAMPLES.ZIP / TILE.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-08-31  |  1.0 KB  |  59 lines

  1. {$A+,B-,D+,E+,F-,G+,I+,L+,N-,O-,P-,Q-,R-,S+,T-,V+,X+}
  2. {$M 16384,0,655360}
  3.  
  4. {
  5. TILE.PAS
  6. Demonstrates     - tile loading
  7.         - scrolling background usage
  8.         - virtual world panning
  9. }
  10.  
  11. uses    crt,uve32;
  12.  
  13. var    dsin,dcos    :array[0..255] of longint;
  14.  
  15.  
  16. procedure init;
  17. var
  18.     i,j:integer;
  19. begin
  20.     ia_inituve;
  21.     ia_setscrolling;
  22.     usebackground:=false;
  23.     ia_loadtil('tiles.uvl',1);
  24.     ia_loadpalette('tiles.pal',pcxpal);
  25.     ia_setscrollarea(-160,-160,40,32);
  26.     ia_setcycletime(40);
  27.     for i:=-10 to 29 do
  28.     for j:=-10 to 21 do ia_puttile(i*16,j*16,(2*(abs(j) mod 2))+1+abs(i) mod 2);
  29.     for i:=0 to 255 do begin
  30.         dsin[i]:=round(-256*sin(pi/2-(2*pi*i/256)));
  31.         dcos[i]:=round( 256*cos(pi/2-(2*pi*i/256)));
  32.     end;
  33.     ia_powerup;
  34.     ia_setpalette(pcxpal);
  35. end;
  36.  
  37. procedure deinit;
  38. begin
  39.     ia_shutdown;
  40.     halt;
  41. end;
  42.  
  43. procedure animate;
  44. var    i:integer;
  45. begin
  46.     ia_doframe;
  47. end;
  48.  
  49. var    i,j:integer;
  50. begin
  51.     init;
  52.     repeat
  53.         vpx:=dcos[frame mod 256];
  54.         vpy:=dsin[frame mod 256];
  55.         animate;
  56.     until keypressed;
  57.  
  58.     deinit;
  59. end.